<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>flex</title>
  <style>
    .center {
      border: 1px solid #000;
      width: 500px;
      display: flex;
      justify-content: center;
    }
    .h-left {
      border: 1px solid #000;
      display: flex;
      justify-content: flex-end;
    }
    .son {
      border: 1px solid red;
      width: 100px;
    }
    .v-center {
      border: 1px solid #000;
      height: 100px;
      display: flex;
      align-items: center;
    }
  </style>
</head>
<body>
  <h1>flex</h1>
  <h2>水平居中</h2>
  <div class="center">
    <div class="son">
      hello
    </div>
    <div class="son">
      hey
    </div>
  </div>
  <h2>水平居右</h2>
  <div class="h-left">
    <div class="son">
      hello
    </div>
    <div class="son">
      hey
    </div>
  </div>
  <h2>垂直居中</h2>
  <div class="v-center">
    <div class="son">
      hello
    </div>
    <div class="son">
      hey
    </div>
  </div>
  <p>
    详情请查看:   <a href="https://www.runoob.com/css3/css3-flexbox.html">flex 教程(超级重要, 一定要学会)</a>
  </p>
</body>
</html>